#!/bin/bash
pkgname=digithand
path=/www/wwwroot/HighDigit
tarname=$pkgname.tar.gz
ip=54.237.55.204
user=ubuntu

# 压缩
projectPath=`pwd`
npm run build
cd dist
tar zvcf $pkgname.tar.gz * --exclude= $projectPath/ssh.pem --exclude= $projectPath/deploy.sh
echo "scp to remote..."
scp   -P 22 -i  $projectPath/ssh.pem    $tarname $user@$ip:~
echo "remove local tar"
rm -f $tarname
ssh  -p 22 -i $projectPath/ssh.pem  $user@$ip "sudo cp ~/$tarname $path;  cd $path;sudo tar zxf $tarname ; sudo rm -f $tarname"


